import request from '@/utils/request'

/**
 * 获取健康评估数据
 * @returns {Promise} 健康评估数据
 */
export const getHealthAssessments = () => {
  return request.get('/api/health/health-assessments')
}

/**
 * 添加健康评估数据
 * @param {Object} data - 健康评估数据
 * @param {number} data.score - 评估分数
 * @param {string} data.category - 评估类别
 * @param {string} data.comments - 评估备注
 * @param {string} data.recorded_at - 记录时间
 * @returns {Promise} 添加结果
 */
export const addHealthAssessments = (data) => {
  return request.post('/api/health/health-assessments', data)
}

/**
 * 更新健康评估数据
 * @param {string} id - 数据ID
 * @param {Object} data - 健康评估数据
 * @returns {Promise} 更新结果
 */
export const updateHealthAssessments = (id, data) => {
  return request.put(`/api/health/health-assessments/${id}`, data)
}

/**
 * 删除健康评估数据
 * @param {string} id - 数据ID
 * @returns {Promise} 删除结果
 */
export const deleteHealthAssessments = (id) => {
  return request.delete(`/api/health/health-assessments/${id}`)
}

export default {
  getHealthAssessments,
  addHealthAssessments,
  updateHealthAssessments,
  deleteHealthAssessments,
}
